package lyj.springcloud.feign;

import lyj.springcloud.feign.impl.OrderFeignFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * 注解@FeignClient(value = "CLOUD-PAYMENT-SERVICE", ---微服务名称
 *                 fallback = GlobalHystrixImpl.class ------ 全局服务降级兜底类
 *                 name：指定FeignClient的名称，如果项目使用了Ribbon，name属性会作为微服务的名称，用于服务发现
 *                 )
 *  以下两种方法都可以实现feign调用服务，服务异常降级
 */
//@FeignClient(value = "CLOUD-PAYMENT-SERVICE",fallback = GlobalHystrixImpl.class)
@FeignClient(name =  "CLOUD-PAYMENT-SERVICE" ,fallbackFactory = OrderFeignFactory.class)
public interface OrderFeign {

    @GetMapping("/payment/ok/{id}")
    public String paymentok(@PathVariable("id") String id);

    @GetMapping("/payment/timeout/{id}")
    public String paymentTimeout(@PathVariable("id") String id);
}
